<template>
  <div class="index">
    <van-search
      v-model="value"
      class="index-top-search"
      show-action
      placeholder="请输入小区或地址"
    >
      <template #label>
        <router-link to="/city">
          <span class="mytz">{{ city.label }}</span>
          <span class="index-top-icon-left">▼</span>
          <span class="index-top-l">|</span></router-link
        >
      </template>
      <template #action
        ><van-icon class="index-top-icon-right" size="25" name="location-o" @click="$router.push('/map')"
      /></template>
    </van-search>
    <van-swipe :autoplay="3000">
      <van-swipe-item v-for="item in pic" :key="item.id">
        <img :src="'http://liufusong.top:8080' + item.imgSrc" />
      </van-swipe-item>
    </van-swipe>
    <van-row gutter="20" class="index-center-bigicon">
      <van-col span="6" class="index-center-pic"
        ><van-icon class="index-center-top-pic" name="wap-home-o" />
        <p>整租</p>
      </van-col>
      <van-col span="6" class="index-center-pic"
        ><van-icon class="index-center-top-pic" name="friends-o" />
        <p>合租</p></van-col
      >
      <van-col span="6" class="index-center-pic"
        ><van-icon class="index-center-top-pic" name="guide-o" />
        <p>地图找房</p></van-col
      >
      <van-col span="6" class="index-center-pic"
        ><van-icon class="index-center-top-pic" name="envelop-o" />
        <p>去出租</p></van-col
      >
    </van-row>
    <div class="center">
      <div class="index-center-nav">
        <div class="left">租房小组</div>
        <div class="right"><a href="JavaScript:;">更多</a></div>
      </div>
      <ul>
        <li v-for="item in zf" :key="item.id">
          <div class="pic">
            <img :src="'http://liufusong.top:8080'+item.imgSrc" class="index-bottom-pic">
          </div>
          <div class="txt">{{item.desc}}{{item.title}}</div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { getSwipe, getGroups } from '@/api/article.js'
export default {
  async created() {
    const res = await getSwipe()
    this.pic = [...res.body]
    const res1 = await getGroups()
    this.zf = [...res1.body]
    console.log(this.zf)
  },
  name: 'MyIndex',
  components: {},
  props: {},
  data() {
    return {
      city: JSON.parse(window.localStorage.getItem('city')) || {
        label: '上海',
        value: 'AREA|dbf46d32-7e76-1196',
        pinyin: 'shanghai',
        short: 'sh'
      },
      value: '',
      pic: [],
      zf: []
    }
  },
  computed: {},
  watch: {},
  methods: {}
}
</script>

<style scoped lang="less">
.index {
  overflow: auto;
}
.mytz {
  color: #000;
}
.van-swipe {
  width: 375px;
  height: 205px;
  img {
    width: 100%;
    height: 100%;
  }
}
p {
  color: #000;
}
.center {
  background-color: rgba(211, 211, 211, 0.396);
  height: 200px;
  margin-bottom: 100px;
}
.index-center-nav {
  display: flex;
  .left {
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 20px;
    color: black;
    font-weight: 700;
    font-size: 15px;
  }
  .right {
    a {
      font-size: 13px;
      display: inline-block;
      margin-top: 10px;
      color: #666;
      margin-left: 250px;
    }
  }
}
ul {
  height: 150px;
  display: flex;
  flex-wrap: wrap;
}
li {
  padding-right: 30px;
  padding-top: 5px;
  margin-top: 10px;
  width: 45%;
  margin: 9px;
  background-color: white;
  height: 61px;
  border-radius: 5px;
  display: flex;
  .pic {
    .index-bottom-pic {
      width: 55px;
      margin-left: 10px;
    }
  }
  .txt {
    font-size: 13px;
    padding-left: 8px;
    padding-top: 7px;
  }
}
.index-center-top-pic {
  margin-bottom: 10px;
  margin-top: 20px;
  border-radius: 50%;
  padding-top: 8px;
  height: 60px;
  width: 60px;
  font-size: 40px;
  // padding-top: 20px ;
  color: #24b97b;
  // border-radius: 60%;
  background-color: rgba(53, 175, 122, 0.11);
}
.index-center-pic {
  display: inline-block;
  height: 120px;
  text-align: center;
  font-size: 17px;
}
.index-top-search {
  position: absolute;
  z-index: 99;
  left: 9px;
  top: 10px;
  background-color: rgba(255, 255, 255, 0);
  width: 363px;
}
.my-swipe {
  position: relative;
}
.index-top-l {
  padding-left: 11px;
  padding-right: 5px;
  color: rgba(62, 59, 59, 0.262);
}
.index-top-icon-left {
  font-size: 12px;
  padding-left: 3px;
  color: gray;
}
.index-top-icon-right {
  margin-top: 10px;
}
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
</style>
